package com.edu.glutdataconvertclient.task;

import com.edu.glutdataconvertclient.controller.ViewController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author ares
 */
@Slf4j
@Component
@Lazy(false)
public class GetData {

    private ViewController viewController;

    @Autowired
    public GetData(ViewController viewController) {
        this.viewController = viewController;
    }

    @Scheduled(cron = "0 0 11 * * ?")
    private void configureTasks() {
        log.info("-----------------------------------定时任务开始----------------------------------");
        viewController.getView();
        log.info("-----------------------------------定时任务结束----------------------------------");
    }
}
